(* process_types.ml - Function to work on arg_modes for process management.
 * Licence: LGPLv3
 * Authors: Franck "kushou" Michea < michea_f@epita.fr >
 *)

let get_process_level = function
  | Types.Base -> -1
  | Types.Grey | Types.NReduc -> 0
  | Types.Edges -> 1
  | Types.Grid -> 2
  | Types.IWEdges | Types.GWEdges -> 3 
  | Types.RH -> 4
  | Types.Obj -> 5

let get_process_fun = function
  | Types.Base -> (fun _ -> ())
  | Types.RH -> Image_functions.request_heights
  | Types.Grey -> Image_functions.image2grey
  | Types.Edges -> Image_functions.edge_detection
  | Types.NReduc -> Image_functions.noise_reduction
  | Types.Grid -> (* Image_functions.show_grid *) (fun _ -> ())
  | Types.IWEdges -> Image_functions.iwedges
  | Types.GWEdges -> Image_functions.gwedges
  | Types.Obj -> Parser.gen_obj
(*  | Types.RequestHeights -> Image_functions.request_heights *)

let get_process_fun_name = function
  | Types.Base | Types.RH -> ""
  | Types.Grey -> "image2grey"
  | Types.Edges -> "edge_detection"
  | Types.Grid -> "show_grid"
  | Types.IWEdges -> "iwedges"
  | Types.GWEdges -> "gwedges"
  | Types.NReduc -> "noise_reduction"
  | Types.Obj -> "gen_obj"
(*
let get_process_result = function
  | Types.Nothing | Types.Output | Types.ShowSteps -> Image_manager.get_image
  | Types.Grey -> Image_manager.get_grey
  | Types.Edges -> Image_manager.get_edges_img
  | Types.IWEdges | Types.RequestHeights -> Image_manager.get_iwedges_img
  | Types.Grid -> Image_manager.get_grid_img
*)
let get_process_list =
  let rec sub = function
    | Types.Base -> []
    | Types.Grey -> [Types.Grey]
    | Types.Edges | Types.NReduc -> sub Types.Grey @ [Types.Edges]
    | Types.Grid -> sub Types.Edges @ [Types.Grid]
    | Types.IWEdges -> sub Types.Edges @ [Types.IWEdges]
    | Types.GWEdges -> sub Types.Edges @ [Types.GWEdges]
    | Types.RH -> sub Types.GWEdges @ [Types.RH]
    | Types.Obj -> sub Types.RH @ [Types.Obj]
  in sub
